<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <sx:head/>
    <title>My JSP 'pubmessage.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js" ></script>
	<script type="text/javascript" src="js/pubmess.js" ></script>
	
	<link rel="stylesheet" type="text/css" href="css/pubmess.css">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body onload="ifUpdate()">
  <div id="zong">
 >>当前位置：消息填写区<br/>
  <form id="myform" method="post">
  <c:choose>
  	<c:when test="${!empty amessage}">
  		<input type="hidden" name="m.messageid" value="${amessage.messageid}" />
  		<input type="hidden" name="m.userinfo.userid" value="${amessage.userinfo.userid}" />
  		<input type="hidden" name="m.ifpublish" value="${amessage.ifpublish}" />
  		<input type="hidden" name="m.recordtime" value="${amessage.recordtime}" />
  	</c:when>
  	<c:otherwise>
  		
  	</c:otherwise>
  </c:choose>
  <br/>
  
   <div id="right">
    		<p>消息标题:</p><input type="text" id="mtitle" name="m.title" value="${amessage.title}" onblur="cktitle()" />&nbsp;&nbsp;&nbsp;
    		<p id="ckmtitle" style="color: red"></p>
    		<p>消息类型:</p><select name="m.messagetype.messagetypeid">
    					<c:forEach items="${messagetypeList}" var="mt">
    						<option value="${mt.messagetypeid}"
    							<c:if test="${amessage.messagetype.messagetypename==mt.messagetypename}">
    								selected="selected"
    							</c:if>
    						>${mt.messagetypename}</option>
    					</c:forEach>
    				</select><br/>
    		<p>开始有效时间:</p><input type="text" name="m.begintime" id="beginTime" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:00',onpicked:null})" value="${amessage.begintime}" onblur="ckbtime()" />&nbsp;&nbsp;&nbsp;
    		<p id="ckmbtime" style="color: red"></p>
    		<p>结束有效时间:</p><input type="text" name="m.endtime" id="endTime" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:00',onpicked:null})" value="${amessage.endtime}" onblur="cketime()" />&nbsp;&nbsp;&nbsp;
    		<p id="ckmetime" style="color: red"></p><br/>
    		<p>发送对象:</p><input type="radio" name="messagetousers" id="all" value="all" onclick="selectusers()"
    				<c:if test="${!empty amessage}">disabled="disabled"</c:if>
    			 	/>所有人
    				<input type="radio" name="messagetousers" id="some" value="some" checked="checked" onclick="selectusers()"
    				<c:if test="${!empty amessage}">disabled="disabled"</c:if>
    				 />选择特定对象<br/>
    		<div id="selectuser">
	    			筛选范围：<br/>
	    			<input type="checkbox" name="ck" id="bumen" onclick="ckbumen()" />按部门
	    			<input type="checkbox" name="ck" id="ygid" onclick="ckygid()" />按员工号
	    			<input type="checkbox" name="ck" id="ygname" checked="checked" onclick="ckygname()" />按姓名<br/><br/>
	    			部门：<select name="depart" id="depart" disabled="disabled">
	    			<option>==请选择==</option>
	    			<c:forEach items="${departinfoList}" var="d">
	    				 <option value="${d.departname}">${d.departname}</option>
	    			</c:forEach>
	    			</select>&nbsp;&nbsp;&nbsp;
	    			员工号:<span><input type="text" id="usid" name="usid"  disabled="disabled" maxlength="10" /></span>&nbsp;&nbsp;&nbsp;
	    			姓名：<span><input type="text" id="usname" name="usname" onkeyup="startRequest()"  maxlength="10" /></span>
	    			(模糊查找  eg:李)&nbsp;&nbsp;&nbsp;<br/>
	    			<div id="divusername">
	    				 	
	    			</div>
	    				 
	    			<sx:a id="selectbutton" targets="touser" href="hzx/selecttou" onclick="showusers()">确定选择范围</sx:a>
	    				 
    				<div id="showuser" style="border:1px solid yellow">
    				请选择发送对象：<br/>
    				 <sx:div id="touser"></sx:div>
    				 </div>
    			</div>
    			<p>消息内容:</p><textarea rows="5" cols="20" name="m.content" id="mcontent" onblur="ckcontent()" >${amessage.content}</textarea>&nbsp;&nbsp;&nbsp;
    			<p id="ckmcontent" style="color: red"></p><br/><br/>
    			<input type="submit" value="添加消息" onclick="javascript:document.getElementById('myform').action='hzx/messageactionadd';document.getElementById('myform').submit();"
    				<c:if test="${amessage!=null}">disabled="disabled"</c:if> />
    			<input type="submit" value="修改消息" onclick="javascript:document.getElementById('myform').action='hzx/messageactionupdate';document.getElementById('myform').submit();"
    				<c:if test="${amessage==null}">disabled="disabled"</c:if> />
    			<input type="button" value="返回" onclick="javascript:history.go(-1)"/>
    </div>
  </form>
  </div>
  </body>
</html>
